export function moveStep(list: string[], id: string, step: number) {
  const index = list.findIndex((v) => v === id)
  if (step === 0) {
    return list
  }
  if (index >= 0) {
    const toIndex = index + step
    const [startIndex, endIndex] = [Math.min(index, toIndex), Math.max(index, toIndex)]
    const startList = list.slice(0, startIndex)
    const endList = list.slice(endIndex)
    if (toIndex < index) {
      const middleList = list.slice(startIndex, endIndex)
      return [...startList, id, ...middleList, ...endList]
    } else if (toIndex > index) {
      const middleList = list.slice(startIndex + 1, endIndex + 1)
      return [...startList, ...middleList, id, ...endList]
    }
  }
  return list
}
